<extend name="Public:base" />
<block name="header_js">
<script type="text/javascript" src="__DATA__/editor/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__DATA__/editor/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript">
$(function(){
    var ue = UE.getEditor('inputContent',{
        serverUrl :"{:U('Public/editorMethod')}"
    });
})
</script>

<script type="text/javascript" src="__PUBLIC__/js/calendar.config.js"></script>
<script type="text/javascript" src="__DATA__/static/jq_plugins/iColorPicker/iColorPicker.js"></script>

<script type="text/javascript">
$(function () {
	//缩略图上传
	var litpic_tip = $(".litpic_tip");
	var btn = $(".up-picture-btn span");
	$("#fileupload").wrap("<form id='myupload' action='{:U('Public/upload',array('img_flag' => 1))}' method='post' enctype='multipart/form-data'></form>");
    $("#fileupload").change(function(){
    	if($("#fileupload").val() == "") return;
		$("#myupload").ajaxSubmit({
			dataType:  'json',
			beforeSend: function() {
        		$('#litpic_show').empty();
				btn.html("上传中...");
    		},
			success: function(data) {
				if(data.state == 'SUCCESS'){
					var fileSize = parseFloat(data.info[0].size/1024).toFixed(2);
					litpic_tip.html(""+ data.info[0].name +" 上传成功("+ fileSize +"k)");
					var img = data.info[0].url;//原图
					var timg = data.info[0].turl;//缩略图
					$('#litpic_show').html("<img src='"+timg+"' width='120'>");
					$("#litpic").val(timg);
				}else {
					litpic_tip.html(data.state);		
				}			
					btn.html("添加图片");

			},
			error:function(xhr){
				btn.html("上传失败");
				litpic_tip.html(xhr);
			}
		});
	});

	$('#CK_JumpUrl').click(function(){
            if($(this).prop('checked')) {
                $('#JumpUrlDiv').show();

            }else {
                $('#JumpUrlDiv').hide();
            }
            
     });
	
});




$(function () {

	$('#BrowerPicture').click(function(){
		layer.open({
			type: 2,
			title: 'XYHCMS',
			shadeClose: true,
			shade: 0.5,
			area: ['670px', '350px'],
			content: "{:U('Public/browseFile', array('stype' => 'picture'))}"
		});
	});	

});


function selectPicture(sfile) {
	layer.msg('选择文件成功')
	$("#litpic").val(sfile);
	$('#litpic_show').html("<img src='"+sfile+"' width='120'>");
}



</script>
	
</block>

<block name="content">
	<div class="row">
		<div class="col-lg-12">
			<h3 class="page-header"><em class="glyphicon glyphicon-cloud-upload"></em> 
			添加文章  
		    </h3>
		</div>
		
	</div>


	<div class="row">
		<div class="col-lg-12">

				<form method='post' class="form-horizontal" id="form_do" name="form_do" action="{:U('edit')}">

                    <div class="form-group">
                        <label for="inputProName" class="col-sm-2 control-label">所属栏目</label>
                        <div class="col-sm-9">
                            <select name="cid" class="form-control">
                                <volist name="cate" id="v">
                                    <option value="{$v.id}" <if condition="$vo['cid'] eq $v['id']">selected="selected"</if>>{$v.delimiter}{$v.name}</option>
                                </volist>
                            </select>
                        </div>
                    </div>

					<div class="form-group">
						<label for="inputTtitle" class="col-sm-2 control-label">捐赠来源</label>
						<div class="col-sm-9">
							<input value="{$vo.source}" type="text" name="source" id="inputTtitle" class="form-control" placeholder="捐赠来源" required="required" />
						</div>
					</div>

					<div class="form-group">
						<label for="inputShorttitle" class="col-sm-2 control-label">捐赠金额</label>
						<div class="col-sm-9">
							<input value="{$vo.money}" type="text" name="money" id="inputShorttitle" class="form-control" placeholder="捐赠金额" />
						</div>
					</div>

					<div class="form-group">
						<label for="inputPublishtime" class="col-sm-2 control-label">捐赠日期</label>
						<div class="col-sm-4">
							<input type="text" class="form-control" name="date" id="inputPublishtime" value="{$vo.date|date='Y/m/d',###}">
			                <script type="text/javascript">
			                    Calendar.setup({
			                        weekNumbers: true,
			                        inputField : "inputPublishtime",
			                        trigger    : "inputPublishtime",
			                        dateFormat: "%Y-%m-%d",
			                        showTime: false,
			                        minuteStep: 1,
			                        onSelect   : function() {this.hide();}
			                    });
			                </script>						
						</div>
					</div>

                    <div class="form-group">
                        <label for="inputProject" class="col-sm-2 control-label">捐赠项目</label>
                        <div class="col-sm-9">
                            <input value="{$vo.project}" type="text" name="project" id="inputProject" class="form-control" placeholder="捐赠项目" />
                        </div>
                    </div>
					
					<div class="row margin-botton-large">
						<div class="col-sm-offset-2 col-sm-9">
							<input type="hidden" name="id" value="{$vo.id}" />
							<div class="btn-group">
								<button type="submit" class="btn btn-primary"> <i class="glyphicon glyphicon-saved"></i>
									保存
								</button>
								<button type="button" onclick="goUrl('{:U('index')}')" class="btn btn-default"> <i class="glyphicon glyphicon-chevron-left"></i>
									返回
								</button>
							</div>
						</div>
					</div>
				</form>
	
		</div>
	</div>

		


</block>